module.exports = options => {
    //回复用户消息
    let replyMessage = `<xml>
    <ToUserName><![CDATA[${options.toUserName}]]></ToUserName>
    <FromUserName><![CDATA[${options.fromUserName}]]></FromUserName>
    <CreateTime>${options.createTime}</CreateTime>
    <MsgType><![CDATA[${options.msgType}]]></MsgType>`;

    switch(options.msgType){
        case "text":
            replyMessage += `<Content><![CDATA[${options.content}]]></Content>`;
            break;
        case "image":
            replyMessage += '<Image><MediaId><![CDATA[' + options.mediaId + ']]></MediaId></Image>';
        case "voice":
            replyMessage += '<Voice><MediaId><![CDATA[' + options.mediaId + ']]></MediaId></Voice>';
        case "video":
            replyMessage += `<Video>
                <MediaId><![CDATA[${options.mediaId}]]></MediaId>
                <Title><![CDATA[${options.title}]]></Title>
                <Description><![CDATA[${options.description}]]></Description>
                </Video>`;
        case "music":
            replyMessage += `<Music>
                <Title><![CDATA[${options.title}]]></Title>
                <Description><![CDATA[${options.description}]]></Description>
                <MusicUrl><![CDATA[${options.musicUrl}]]></MusicUrl>
                <HQMusicUrl><![CDATA[${options.hqMusicUrl}]]></HQMusicUrl>
                <ThumbMediaId><![CDATA[${options.mediaId}]]></ThumbMediaId>
                </Music>`;
        case "news":
            replyMessage += `<ArticleCount>${options.content.length}</ArticleCount><Articles>`;
            options.content.forEach(item => {
                replyMessage += `<item>
                <Title><![CDATA[${item.title}]]></Title>
                <Description><![CDATA[${item.description}]]></Description>
                <PicUrl><![CDATA[${item.picUrl}]]></PicUrl>
                <Url><![CDATA[${item.url}]]></Url>
                </item>`
            });
            replyMessage += '</Articles>';
    }
    replyMessage += '</xml>';
    return replyMessage
}